import sys
import os
import unittest, time

BASE_PATH = os.path.dirname(
    os.path.dirname(os.path.abspath(__file__))
)
sys.path.insert(0,BASE_PATH)
print(BASE_PATH)

from page_object.login import Login_Action
from test_case.test01regsiterCase import RegsiterCase
from test_case.test02loginCase import LoginCase
from test_case.test03userManagerCase import UserManagerCase
from test_case.test04analyzerCase import AnalyzerCase
from test_case.test05pluginsCase import PluginsCase
from test_case.test06fileManageCase import FileManagerCase
from test_case.test07helpPageCase import HelpPageCase
from test_case.test08datamarketCase import DataMarketCase
from test_case.test10abordSearchCase import AbordDataSearchCase
from test_case.test11accountSearchCase import AccountSearchCase
from test_case.test12companySearchCase import CompanySearchCase
from test_case.test13commentSearchCase import CommentSearchCase
from test_case.test14markManageCase import MarksManageCase
from bin.HTMLTestRunner import HTMLTestRunner


if __name__ == '__main__':

    suite = unittest.TestSuite()
    # suite.addTest(unittest.makeSuite(RegsiterCase))  # 验证通过
    # suite.addTest(unittest.makeSuite(LoginCase))  # 验证通过
    # suite.addTest(unittest.makeSuite(UserManagerCase)) # 验证通过
    # suite.addTest(unittest.makeSuite(AnalyzerCase)) #验证通过
    # suite.addTest(unittest.makeSuite(PluginsCase)) #验证通过
    # suite.addTest(unittest.makeSuite(FileManagerCase))
    suite.addTest(unittest.makeSuite(HelpPageCase)) #验证通过
    # suite.addTest(unittest.makeSuite(DataMarketCase)) #验证通过
    # suite.addTest(unittest.makeSuite(AbordDataSearchCase))#验证通过
    # suite.addTest(unittest.makeSuite(AccountSearchCase))#验证通过
    # suite.addTest(unittest.makeSuite(CompanySearchCase))#验证通过
    # suite.addTest(unittest.makeSuite(CommentSearchCase))#验证通过
    # suite.addTest(unittest.makeSuite(MarksManageCase))#验证通过

    # suite=unittest.makeSuite()
    timeMark = (time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime()))
    filename = BASE_PATH + '/report/report_{}.html'.format(timeMark)
    fp = open(filename, 'wb')
    runner = HTMLTestRunner(fp, title="星光数据平台Ui自动化测试报告", description='test')
    runner.run(suite)
    Login_Action().quit()

